package cn.wolfcode.luowowo.mgrsite.controller;

import cn.wolfcode.luowowo.article.domain.StrategyTag;
import cn.wolfcode.luowowo.article.service.IDestinationService;
import cn.wolfcode.luowowo.article.service.IStrategyTagService;
import cn.wolfcode.luowowo.article.service.IStrategyService;
import cn.wolfcode.luowowo.common.query.QueryObject;
import cn.wolfcode.luowowo.common.util.AjaxResult;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Administrator on 2019/7/9.
 */
@Controller
@RequestMapping("strategyTag")
public class StrategyTagController {
    @Reference
    private IStrategyTagService strategyTagService;

    @RequestMapping("list")
    public String list(Model model, @ModelAttribute("qo") QueryObject qo) {
        model.addAttribute("pageInfo", strategyTagService.query(qo));
        return "strategyTag/list";
    }

    @RequestMapping("delete")
    @ResponseBody
    public Object delete(Long id) {
        strategyTagService.delete(id);
        return new AjaxResult();
    }

    @RequestMapping("saveOrUpdate")
    @ResponseBody
    public Object saveOrUpdate(StrategyTag strategyTag) {
        strategyTagService.saveOrUpdate(strategyTag);
        return new AjaxResult();
    }
}
